﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.UI;

public class FlyItemParameter : MonoBehaviour
{
    public Text m_VolumeL;
    public Text m_WeightL;
    public Text m_ShotFrequencyL;
    public Text m_ReloadFrequencyL;
    public Weapon.ItemType m_WeaponType;

    public ConfigFlyitemContent m_FlyItemContent;
    protected FlyItem m_FlyItem;
    void Start()
    {
    }
    void Update()
    {
    }
    public virtual void Init(FlyItem flyItem)
    {
        m_FlyItem = flyItem;
        float volume = 0;
        var flyItemTexture = m_FlyItemContent.m_FlyingItemImage.sprite.texture;
        for(int x=0; x<flyItemTexture.width; ++x)
        {
            for(int y =0; y<flyItemTexture.height; ++y)
            {
                if(flyItemTexture.GetPixel(x, y).a > 0)
                {
                    volume++;
                }
            }
        }
        m_FlyItem.volume = Mathf.Sqrt(volume);
        m_VolumeL.text = m_FlyItem.volume.ToString("0.00");
    }
}